#pragma once
#include <iostream>
extern"C"
{
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <sys/ioctl.h>
#include <stdbool.h>
}

using namespace std;
class LcdDevice
{
    int fd;
    int w, h, pix;
    unsigned int* mptr; 
    LcdDevice(string devname="/dev/fb0");
    LcdDevice(const LcdDevice& lcd) {};
public:
    static LcdDevice* getLcd() {
        static LcdDevice lcd;
        return &lcd;
    }
    ~LcdDevice();
    void clear(unsigned int color=0x00ffffff);
    void drawRect(int x, int y, int w, int h, unsigned int color);
    void drawFill(int x, int y, int w, int h, unsigned int color);
    void drawLine(int x1, int y1, int x2, int y2);
    void drawCircle(int x, int y, int r);
    void drawRgb(int x, int y, unsigned char* rgb, int w, int h);
};

